using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class SupportDAL : SqlDataProvider	{		#region[Support_GetById]		public List<Support> Support_GetById(string Id)		{			List<Data.Support> list = new List<Data.Support>();			using (SqlCommand dbCmd = new SqlCommand("sp_Support_GetById", GetConnection()))			{				Data.Support obj = new Data.Support();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.SupportIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Support_GetByTop]		public List<Support> Support_GetByTop(string Top, string Where, string Order)		{			List<Data.Support> list = new List<Data.Support>();			using (SqlCommand dbCmd = new SqlCommand("sp_Support_GetByTop", GetConnection()))			{				Data.Support obj = new Data.Support();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.SupportIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Support_GetByAll]		public List<Support> Support_GetByAll(string Lang)		{			List<Data.Support> list = new List<Data.Support>();			using (SqlCommand dbCmd = new SqlCommand("sp_Support_GetByAll", GetConnection()))			{				Data.Support obj = new Data.Support();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.SupportIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Support_Paging]		public List<Support> Support_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.Support> list = new List<Data.Support>();			using (SqlCommand dbCmd = new SqlCommand("sp_Support_Paging", GetConnection()))			{				Data.Support obj = new Data.Support();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.SupportIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[Support_Insert]		public bool Support_Insert(Support data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Support_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Phone", data.Phone));				dbCmd.Parameters.Add(new SqlParameter("@Type", data.Type));				dbCmd.Parameters.Add(new SqlParameter("@NickYM", data.NickYM));				dbCmd.Parameters.Add(new SqlParameter("@NickSkpye", data.NickSkpye));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@PageId", data.PageId == "" || data.PageId == "0" ? DBNull.Value : (object)data.PageId));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Support");			return true;		}		#endregion		#region[Support_Update]		public bool Support_Update(Support data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Support_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Phone", data.Phone));				dbCmd.Parameters.Add(new SqlParameter("@Type", data.Type));				dbCmd.Parameters.Add(new SqlParameter("@NickYM", data.NickYM));				dbCmd.Parameters.Add(new SqlParameter("@NickSkpye", data.NickSkpye));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@PageId", data.PageId == "" || data.PageId == "0" ? DBNull.Value : (object)data.PageId));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Support");			return true;		}		#endregion		#region[Support_Delete]		public bool Support_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Support_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Support");			return true;		}		#endregion			}}